<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>函数式组件</title>
    <style>
        header{
            height: 100px;
            background: #aef;
        }

        section{
            height: 400px;
            background: #aab;
        }

        footer{
            height: 100px;
            background: #fea;
        }
    </style>
</head>
<body>
    <div id="root"></div>
    <script src="../js/react.development.js"></script>
    <script src="../js/react-dom.development.js"></script>
    <script src="../js/babel.min.js"></script>

    <script type="text/babel">
        //函数式组件  函数名称首字母『一定』要大写
        function Head(){
            //返回虚拟 DOM 对象
            return <header>头部内容</header>;
        }

        //主体部分
        function Main(){
            return <section>主体内容</section>;
        }

        //底部内容
        function Foot(){
            return <footer>尾部内容</footer>;
        }

        //React 会寻找与组件标签名『同名的函数』, 然后调用得到『虚拟DOM对象』
        // let vDOM = <div>
        //         <Head></Head>
        //         <Main />
        //         <Foot />
        //     </div>;
        function App(){
            return <div>
                <Head></Head>
                <Main />
                <Foot />
            </div>;
        }

        ReactDOM.render(<App />, document.querySelector('#root'));
    </script>
</body>
</html>